﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
//Added
using MenuSystem.Models;
using System.Data.SqlClient;



namespace MenuSystem.Controllers
{

    
    public class HomeController : Controller
    {
        public FunctionsHere queries = new FunctionsHere();
      
        //
        // GET: /Home/

        public ActionResult Index()
        {

            ViewData["CafeDesc"] = queries.getCafeDescription("Prisms");
            ViewData["Buildings"] = new SelectList(queries.getAllBuildingNames());
            ViewData["Cafes"] = new SelectList(queries.getAllCafeNames());
            ViewData["FoodItems"] = new SelectList(queries.getFoodItems());
            ViewData["FoodDesc"] = new SelectList(queries.getFoodDesc());
            return View();
        }

        //

        // GET: /Home/Menu2

        public ActionResult Menu2(string selectedCafe, DateTime date)
        {
            ViewData["Buildings"] = new SelectList(queries.getAllBuildingNames());
            ViewData["CafeName"] = queries.getCafeName(selectedCafe).ToList();
            ViewData["Cafes"] = new SelectList(queries.getAllCafeNames());
            ViewData["CafeDesc"] = queries.getCafeDescription("");
            ViewData["FoodItems"] = new SelectList(queries.getFoodItems());
            ViewData["FoodDesc"] = new SelectList(queries.getFoodDesc());
            ViewData["FoodItems"] = new SelectList(queries.getFoodItems());
            return View();
        }

        
      

        // GET: /Home/Menu


        public ActionResult Menu(string selectedCafe, DateTime date)
        {
            ViewData["Buildings"] = new SelectList(queries.getAllBuildingNames());
            ViewData["CafeName"] = queries.getCafeName(selectedCafe).ToList();
            ViewData["Cafes"] = new SelectList(queries.getAllCafeNames());
            ViewData["CafeDesc"] = queries.getCafeDescription("Scotties Espresso Coffee Cart ( Lobby)");
            ViewData["FoodItems"] = new SelectList(queries.getFoodItems());
            ViewData["FoodDesc"] = new SelectList(queries.getFoodDesc());
<<<<<<< .mine
            ViewData["FoodItems"] = new SelectList(queries.getFoodItems());
=======
            ViewData["Buildings"] = new SelectList(queries.getAllBuildingNames());
>>>>>>> .r75
            return View();
        }

        //
        // GET: /Home/Details/5

        public ActionResult Details(int id)
        {



            ViewData["CafeDesc"] = queries.getCafeDescription("Prisms");
            ViewData["Buildings"] = new SelectList(queries.getAllBuildingNames());
            ViewData["Cafes"] = new SelectList(queries.getAllCafeNames());
            ViewData["FoodItems"] = new SelectList(queries.getFoodItems());
            return View();
        }

        //
        // GET: /Home/Create

        public ActionResult Create()
        {

            return View();

        }  


        //
        // POST: /Home/Create

        [HttpPost]
        public ActionResult Create(FormCollection collection)
        {
            try
            {
                // TODO: Add insert logic here

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
        
        //
        // GET: /Home/Edit/5
 
        public ActionResult Edit(int id)
        {
            return View();
        }

        //
        // POST: /Home/Edit/5

        [HttpPost]
        public ActionResult Edit(int id, FormCollection collection)
        {
            try
            {
                // TODO: Add update logic here
 
                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }

        //
        // GET: /Home/Delete/5
 
        public ActionResult Delete(int id)
        {
            return View();
        }

        //
        // POST: /Home/Delete/5

        [HttpPost]
        public ActionResult Delete(int id, FormCollection collection)
        {
            try
            {
                // TODO: Add delete logic here
 
                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }

        //
        //GET: /Home/Tab
        public ActionResult GetTab()
        {
            MenuSystem.Services.tabTextService serv = new MenuSystem.Services.tabTextService();
            tabViewModel myModel = serv.getTabViewModel();

            return View(myModel);
        }
    }
}
